<%@ include file="/common/taglibs.jsp" %>
<head>
	<title><spring:message code="pickingLists.seePickingList.header"/></title>
	<style type="text/css">
	table {
		margin-bottom: 10px;
		width: 100%;
	}
	table.solid, table.solid th, table.solid td {
		border: 1px solid black;
		border-collapse:collapse;
	}
	
	.center {
		margin: auto;
	}
	</style>
</head>
<h1 style="text-align: center;"><spring:message code="bookstore.name"/> <spring:message code="pickingLists.seePickingList.header"/></h1>
<table class="center">
	<tr>
		<td>
		<table>
			<tr>
				<td rowspan="2"><spring:message code="bookstore.address"/></td>
				<td><spring:message code="bookstore.phoneNumber.title"/>:</td>
				<td><spring:message code="bookstore.phoneNumber"/></td>
			</tr>
			<tr>
				<td><spring:message code="bookstore.faxNumber.title"/>:</td>
				<td><spring:message code="bookstore.faxNumber"/></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td>
		<h2><spring:message code="pickingLists.seePickingList.id"/>: <c:out value="${order.id}"/>-<c:out value="${pickingList.sequence}"/></h2>
		<table class="solid">
			<tr>
				<th><spring:message code="pickingLists.seePickingList.pickingListItem.sequence"/></th>
				<th><spring:message code="pickingLists.seePickingList.orderItem.book.isbn"/></th>
				<th><spring:message code="pickingLists.seePickingList.orderItem.book.ean"/></th>
				<th><spring:message code="pickingLists.seePickingList.orderItem.product.name"/></th>
				<th><spring:message code="pickingLists.seePickingList.orderItem.product.fixedPrice"/></th>
				<th><spring:message code="pickingLists.seePickingList.orderItem.product.unitPrice"/></th>
				<th><spring:message code="pickingLists.seePickingList.orderItem.quantity"/></th>
				<th><spring:message code="pickingLists.seePickingList.orderItem.total"/></th>
			</tr>
			<c:forEach var="item" items="${pickingList.pickingListItems}">
				<tr>
					<td><c:out value="${item.sequence}" /></td>
					<td><c:out value="${item.orderItem.orderedBook.isbn}" /></td>
					<td><c:out value="${item.orderItem.orderedBook.ean}" /></td>
					<td><c:out value="${item.orderItem.orderedBook.name}" /></td>
					<td><c:out value="${item.orderItem.orderedBook.fixedPrice}" /></td>
					<td><c:out value="${item.orderItem.orderedBook.unitPrice}" /></td>
					<td><c:out value="${item.orderItem.quantity}" /></td>
					<td><c:out value="${item.orderItem.totalUnitPrice}" /></td>
				</tr>
			</c:forEach>
			<tr>
				<th colspan="7"><spring:message code="pickingLists.seePickingList.order.deliveryFee"/></th>
				<td><c:out value="${order.deliveryFee}"/></td>
			</tr>
			<tr>
				<th colspan="7"><spring:message code="pickingLists.seePickingList.order.price"/></th>
				<td><c:out value="${order.price}"/></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td>
		<h2><spring:message code="pickingLists.seePickingList.deliveryInfo.header"/></h2>
		<table class="solid">
			<tr>
				<th><spring:message code="pickingLists.seePickingList.order.paymentType"/>/<spring:message code="pickingLists.seePickingList.order.deliveryServiceType"/></th>
				<td><spring:message code="${sf:getPaymentMessageCode(order.payment)}"/>/<spring:message code="${order.deliveryService.name}"/></td>
				
				<th><spring:message code="pickingLists.seePickingList.order.userAccount.userName"/></th>
				<td><c:out value="${userAccount.userName}"/></td>
				
				<th><spring:message code="pickingLists.seePickingList.order.userAccount.cellPhoneNumber"/></th>
				<td><c:out value="${userAccount.cellPhoneNumber}"/></td>
			</tr>
			<tr>
				<th><spring:message code="pickingLists.seePickingList.order.invoice.invoiceTitle"/></th>
				<td><c:out value="${order.invoice.invoiceTitle}"/></td>
				
				<th><spring:message code="pickingLists.seePickingList.order.invoice.uniformNumber"/></th>
				<td><c:out value="${order.invoice.uniformNumber}"/></td>
				
				<th><spring:message code="pickingLists.seePickingList.order.invoice.type"/></th>
				<td><spring:message code="${sf:getInvoiceMessageCode(order.invoice)}"/></td>
			</tr>
			<tr>
				<th><spring:message code="pickingLists.seePickingList.order.invoice.invoiceNumber"/></th>
				<td><c:out value="${order.invoice.invoiceNumber}"></c:out></td>
				
				<th><spring:message code="pickingLists.seePickingList.order.recipient.name"/></th>
				<td><c:out value="${order.recipientName}"/></td>
				
				<th><spring:message code="pickingLists.seePickingList.order.recipient.cellPhoneNumber"/></th>
				<td><c:out value="${order.recipientCellPhoneNumber}"/></td>
			</tr>
			<tr>
				<th><spring:message code="pickingLists.seePickingList.order.invoice.updateTime"/></th>
				<td><fmt:formatDate value="${order.invoice.updateTime}" pattern="${datePattern}"/></td>
				
				<th><spring:message code="pickingLists.seePickingList.updateTime"/></th>
				<td><fmt:formatDate value="${pickingList.updateTime}" pattern="${datePattern}"/></td>
				
				<th><spring:message code="pickingLists.seePickingList.clerk.name"/></th>
				<td><c:out value="${clerk.userName}"/></td>
			</tr>
			<tr>
				<th><spring:message code="pickingLists.seePickingList.order.recipient.address"/></th>
				<td colspan="5"><c:out value="${order.recipientAddress}"/></td>
			</tr>
			<tr>
				<th><spring:message code="pickingLists.seePickingList.order.extraRequirements"/></th>
				<td colspan="5"><c:out value="${order.extraRequirements}"/></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr style="text-align: right;">
		<td><a style="margin-right: 10px;" href="<spring:url value='${previousPath}'/>"><spring:message code="pickingLists.seePickingList.goToPreviousPath"/></a></td>
	</tr>
	
</table>